<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UC-QA-003：语音合成原型</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@5.12.8/dist/reset.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }
        
        .header {
            background: #fff;
            padding: 16px 24px;
            border-bottom: 1px solid #e8e8e8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        .breadcrumb {
            color: #666;
            font-size: 14px;
        }
        
        .breadcrumb a {
            color: #1890ff;
            text-decoration: none;
        }
        
        .main-content {
            padding: 24px;
            max-width: 1400px;
            margin: 0 auto;
        }
        
        .content-area {
            display: grid;
            grid-template-columns: 240px 1fr;
            gap: 24px;
        }
        
        .sidebar {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .sidebar-header {
            background: #fafafa;
            padding: 16px 20px;
            border-bottom: 1px solid #e8e8e8;
        }
        
        .sidebar-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .sidebar-content {
            padding: 16px;
        }
        
        .history-list {
            list-style: none;
            margin-bottom: 24px;
        }
        
        .history-item {
            padding: 12px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s;
            margin-bottom: 8px;
            border: 1px solid #f0f0f0;
        }
        
        .history-item:hover {
            background: #f8f9fa;
            border-color: #1890ff;
        }
        
        .history-item.active {
            background: #e6f7ff;
            border-color: #1890ff;
        }
        
        .history-time {
            font-size: 11px;
            color: #999;
            margin-bottom: 4px;
        }
        
        .history-text {
            font-size: 12px;
            color: #333;
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        .history-voice {
            font-size: 10px;
            color: #666;
            margin-top: 4px;
        }
        
        .template-list {
            list-style: none;
        }
        
        .template-item {
            padding: 8px 0;
            cursor: pointer;
            font-size: 13px;
            color: #666;
            transition: color 0.3s;
            border-bottom: 1px solid #f0f0f0;
        }
        
        .template-item:hover {
            color: #1890ff;
        }
        
        .template-item:last-child {
            border-bottom: none;
        }
        
        .main-panel {
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .panel-header {
            background: #fafafa;
            padding: 16px 20px;
            border-bottom: 1px solid #e8e8e8;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .panel-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .status-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #52c41a;
        }
        
        .status-text {
            font-size: 12px;
            color: #666;
        }
        
        .panel-content {
            padding: 24px;
        }
        
        .text-input-section {
            margin-bottom: 24px;
        }
        
        .text-editor {
            width: 100%;
            min-height: 200px;
            padding: 16px;
            border: 2px solid #e8e8e8;
            border-radius: 8px;
            font-size: 14px;
            line-height: 1.6;
            resize: vertical;
            transition: border-color 0.3s;
        }
        
        .text-editor:focus {
            outline: none;
            border-color: #1890ff;
            box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
        }
        
        .text-tools {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 12px;
        }
        
        .text-stats {
            font-size: 12px;
            color: #666;
        }
        
        .text-actions {
            display: flex;
            gap: 8px;
        }
        
        .btn {
            padding: 6px 12px;
            border: 1px solid;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .btn-primary:hover {
            background: #40a9ff;
            border-color: #40a9ff;
        }
        
        .btn-success {
            background: #52c41a;
            border-color: #52c41a;
            color: #fff;
        }
        
        .btn-success:hover {
            background: #73d13d;
            border-color: #73d13d;
        }
        
        .btn-default {
            background: #fff;
            border-color: #d9d9d9;
            color: #333;
        }
        
        .btn-default:hover {
            border-color: #1890ff;
            color: #1890ff;
        }
        
        .voice-parameters {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 24px;
        }
        
        .parameters-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        .parameter-group {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        
        .parameter-item {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .parameter-label {
            font-size: 13px;
            color: #333;
            font-weight: 500;
        }
        
        .parameter-control {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .parameter-control select {
            flex: 1;
            padding: 6px 8px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            font-size: 12px;
        }
        
        .parameter-control input[type="range"] {
            flex: 1;
        }
        
        .parameter-value {
            font-size: 11px;
            color: #666;
            min-width: 30px;
        }
        
        .voice-preview {
            background: #f0f8ff;
            border: 1px solid #b3d8ff;
            border-radius: 6px;
            padding: 12px;
            margin-bottom: 16px;
        }
        
        .preview-text {
            font-size: 12px;
            color: #1890ff;
            margin-bottom: 8px;
        }
        
        .preview-controls {
            display: flex;
            gap: 8px;
        }
        
        .playback-control {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
        }
        
        .playback-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .playback-title {
            font-size: 14px;
            font-weight: 600;
            color: #333;
        }
        
        .playback-status {
            font-size: 12px;
            color: #666;
        }
        
        .playback-buttons {
            display: flex;
            gap: 12px;
            margin-bottom: 16px;
        }
        
        .btn-large {
            padding: 12px 24px;
            font-size: 14px;
        }
        
        .progress-container {
            margin-bottom: 16px;
        }
        
        .progress-bar {
            width: 100%;
            height: 6px;
            background: #f0f0f0;
            border-radius: 3px;
            overflow: hidden;
            cursor: pointer;
        }
        
        .progress-fill {
            height: 100%;
            background: #1890ff;
            border-radius: 3px;
            width: 0%;
            transition: width 0.3s;
        }
        
        .time-display {
            display: flex;
            justify-content: space-between;
            font-size: 11px;
            color: #666;
            margin-top: 4px;
        }
        
        .audio-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .volume-control {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .volume-slider {
            width: 100px;
            height: 4px;
            background: #f0f0f0;
            border-radius: 2px;
            position: relative;
            cursor: pointer;
        }
        
        .volume-fill {
            height: 100%;
            background: #1890ff;
            border-radius: 2px;
            width: 70%;
        }
        
        .rate-control {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .rate-select {
            padding: 4px 8px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            font-size: 11px;
        }
        
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: #fff;
            border-radius: 8px;
            padding: 24px;
            max-width: 600px;
            width: 90%;
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }
        
        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 20px;
        }
        
        @media (max-width: 768px) {
            .content-area {
                grid-template-columns: 1fr;
            }
            
            .sidebar {
                order: -1;
            }
            
            .parameters-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <!-- 页面头部 -->
    <div class="header">
        <div class="breadcrumb">
            <a href="#">首页</a> > <a href="#">语音服务</a> > 语音合成
        </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
        <div class="content-area">
            <!-- 侧边栏 -->
            <div class="sidebar">
                <div class="sidebar-header">
                    <div class="sidebar-title">合成历史</div>
                </div>
                <div class="sidebar-content">
                    <ul class="history-list">
                        <li class="history-item active" onclick="selectHistory(this)">
                            <div class="history-time">2024-05-15 14:30</div>
                            <div class="history-text">欢迎学习基础操作培训课程，请按照标准流程执行任务。</div>
                            <div class="history-voice">中文 - 女声</div>
                        </li>
                        <li class="history-item" onclick="selectHistory(this)">
                            <div class="history-time">2024-05-15 14:25</div>
                            <div class="history-text">操作前必须佩戴安全防护用品，确保工作环境安全。</div>
                            <div class="history-voice">中文 - 男声</div>
                        </li>
                        <li class="history-item" onclick="selectHistory(this)">
                            <div class="history-time">2024-05-15 14:20</div>
                            <div class="history-text">Welcome to the training course. Please follow the safety procedures.</div>
                            <div class="history-voice">英文 - 女声</div>
                        </li>
                        <li class="history-item" onclick="selectHistory(this)">
                            <div class="history-time">2024-05-15 14:15</div>
                            <div class="history-text">Chào mừng đến với khóa học đào tạo cơ bản.</div>
                            <div class="history-voice">越南语 - 女声</div>
                        </li>
                    </ul>
                    
                    <div style="margin-bottom: 20px;">
                        <div class="sidebar-title" style="margin-bottom: 12px;">语音模板</div>
                        <ul class="template-list">
                            <li class="template-item" onclick="selectTemplate('training')">🎓 培训模板</li>
                            <li class="template-item" onclick="selectTemplate('safety')">⚠️ 安全模板</li>
                            <li class="template-item" onclick="selectTemplate('welcome')">👋 欢迎模板</li>
                            <li class="template-item" onclick="selectTemplate('instruction')">📋 指导模板</li>
                        </ul>
                    </div>
                </div>
            </div>

            <!-- 主面板 -->
            <div class="main-panel">
                <div class="panel-header">
                    <div class="panel-title">语音合成</div>
                    <div class="status-indicator">
                        <div class="status-dot"></div>
                        <span class="status-text">服务正常</span>
                    </div>
                </div>
                
                <div class="panel-content">
                    <!-- 文本输入区域 -->
                    <div class="text-input-section">
                        <textarea class="text-editor" id="textEditor" placeholder="请输入要合成的文本内容...">欢迎学习基础操作培训课程，请按照标准流程执行任务。在开始操作前，请确保佩戴安全防护用品，检查工作环境是否安全。</textarea>
                        
                        <div class="text-tools">
                            <div class="text-stats">
                                字数: <span id="charCount">45</span> / 1000
                            </div>
                            <div class="text-actions">
                                <button class="btn btn-default" onclick="formatText()">📝 格式化</button>
                                <button class="btn btn-default" onclick="checkGrammar()">✅ 语法检查</button>
                                <button class="btn btn-default" onclick="translateText()">🌐 翻译</button>
                                <button class="btn btn-default" onclick="clearText()">🗑️ 清空</button>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 语音参数设置 -->
                    <div class="voice-parameters">
                        <div class="parameters-grid">
                            <div class="parameter-group">
                                <div class="parameter-item">
                                    <div class="parameter-label">语音类型</div>
                                    <div class="parameter-control">
                                        <select id="voiceSelect">
                                            <option value="zh-female-1" selected>中文女声1</option>
                                            <option value="zh-female-2">中文女声2</option>
                                            <option value="zh-male-1">中文男声1</option>
                                            <option value="zh-male-2">中文男声2</option>
                                            <option value="en-female-1">英文女声1</option>
                                            <option value="en-male-1">英文男声1</option>
                                        </select>
                                        <button class="btn btn-default" onclick="previewVoice()">👂 试听</button>
                                    </div>
                                </div>
                                
                                <div class="parameter-item">
                                    <div class="parameter-label">语速</div>
                                    <div class="parameter-control">
                                        <input type="range" min="0.5" max="2.0" step="0.1" value="1.0" id="speedSlider">
                                        <span class="parameter-value" id="speedValue">1.0x</span>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="parameter-group">
                                <div class="parameter-item">
                                    <div class="parameter-label">音调</div>
                                    <div class="parameter-control">
                                        <input type="range" min="-10" max="10" step="1" value="0" id="pitchSlider">
                                        <span class="parameter-value" id="pitchValue">0</span>
                                    </div>
                                </div>
                                
                                <div class="parameter-item">
                                    <div class="parameter-label">音量</div>
                                    <div class="parameter-control">
                                        <input type="range" min="0" max="100" step="1" value="80" id="volumeSlider">
                                        <span class="parameter-value" id="volumeValue">80%</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="voice-preview">
                            <div class="preview-text">预览: "欢迎学习基础操作培训课程"</div>
                            <div class="preview-controls">
                                <button class="btn btn-primary" onclick="previewSynthesis()">▶️ 试听</button>
                                <button class="btn btn-default" onclick="stopPreview()">⏹️ 停止</button>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 播放控制 -->
                    <div class="playback-control">
                        <div class="playback-header">
                            <div class="playback-title">播放控制</div>
                            <div class="playback-status" id="playbackStatus">准备就绪</div>
                        </div>
                        
                        <div class="playback-buttons">
                            <button class="btn btn-success btn-large" onclick="startSynthesis()" id="synthesisBtn">🎵 开始合成</button>
                            <button class="btn btn-primary btn-large" onclick="playAudio()" id="playBtn" disabled>▶️ 播放</button>
                            <button class="btn btn-default btn-large" onclick="pauseAudio()" id="pauseBtn" disabled>⏸️ 暂停</button>
                            <button class="btn btn-default btn-large" onclick="stopAudio()" id="stopBtn" disabled>⏹️ 停止</button>
                            <button class="btn btn-default btn-large" onclick="exportAudio()" id="exportBtn" disabled>💾 导出</button>
                        </div>
                        
                        <div class="progress-container">
                            <div class="progress-bar" onclick="seekAudio(event)">
                                <div class="progress-fill" id="progressFill"></div>
                            </div>
                            <div class="time-display">
                                <span id="currentTime">0:00</span>
                                <span id="totalTime">0:00</span>
                            </div>
                        </div>
                        
                        <div class="audio-controls">
                            <div class="volume-control">
                                <span>🔊</span>
                                <div class="volume-slider" onclick="adjustVolume(event)">
                                    <div class="volume-fill" id="volumeFill"></div>
                                </div>
                                <span id="volumeDisplay">70%</span>
                            </div>
                            
                            <div class="rate-control">
                                <span>速度:</span>
                                <select class="rate-select" id="playbackRate">
                                    <option value="0.5">0.5x</option>
                                    <option value="0.75">0.75x</option>
                                    <option value="1" selected>1x</option>
                                    <option value="1.25">1.25x</option>
                                    <option value="1.5">1.5x</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 导出弹窗 -->
    <div class="modal" id="exportModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">导出音频</h3>
                <button class="modal-close" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div style="margin-bottom: 16px;">
                    <label style="display: block; margin-bottom: 8px; font-weight: 500;">文件格式</label>
                    <select style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
                        <option value="mp3" selected>MP3</option>
                        <option value="wav">WAV</option>
                        <option value="ogg">OGG</option>
                        <option value="m4a">M4A</option>
                    </select>
                </div>
                <div style="margin-bottom: 16px;">
                    <label style="display: block; margin-bottom: 8px; font-weight: 500;">音频质量</label>
                    <select style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
                        <option value="high" selected>高质量 (320kbps)</option>
                        <option value="medium">中等质量 (192kbps)</option>
                        <option value="low">低质量 (128kbps)</option>
                    </select>
                </div>
                <div>
                    <label style="display: block; margin-bottom: 8px; font-weight: 500;">文件名</label>
                    <input type="text" value="语音合成_20240515" style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;">
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" onclick="closeModal()">取消</button>
                <button class="btn btn-primary" onclick="confirmExport()">导出</button>
            </div>
        </div>
    </div>

    <script>
        // 全局变量
        let isSynthesizing = false;
        let isPlaying = false;
        let isPaused = false;
        let currentTime = 0;
        let totalTime = 0;

        // 文本处理
        function formatText() {
            console.log('格式化文本');
        }

        function checkGrammar() {
            console.log('语法检查');
        }

        function translateText() {
            console.log('翻译文本');
        }

        function clearText() {
            document.getElementById('textEditor').value = '';
            updateCharCount();
        }

        function updateCharCount() {
            const text = document.getElementById('textEditor').value;
            document.getElementById('charCount').textContent = text.length;
        }

        // 语音合成
        function startSynthesis() {
            isSynthesizing = true;
            const synthesisBtn = document.getElementById('synthesisBtn');
            const playBtn = document.getElementById('playBtn');
            
            synthesisBtn.textContent = '🔄 合成中...';
            synthesisBtn.disabled = true;
            
            // 模拟合成过程
            setTimeout(() => {
                isSynthesizing = false;
                synthesisBtn.textContent = '🎵 开始合成';
                synthesisBtn.disabled = false;
                playBtn.disabled = false;
                document.getElementById('playbackStatus').textContent = '合成完成';
                totalTime = 30; // 30秒
                updateTimeDisplay();
            }, 3000);
            
            console.log('开始合成');
        }

        function previewSynthesis() {
            console.log('试听合成');
        }

        function stopPreview() {
            console.log('停止试听');
        }

        function previewVoice() {
            console.log('试听语音');
        }

        // 播放控制
        function playAudio() {
            isPlaying = true;
            isPaused = false;
            
            const playBtn = document.getElementById('playBtn');
            const pauseBtn = document.getElementById('pauseBtn');
            const stopBtn = document.getElementById('stopBtn');
            
            playBtn.disabled = true;
            pauseBtn.disabled = false;
            stopBtn.disabled = false;
            
            document.getElementById('playbackStatus').textContent = '播放中...';
            
            // 模拟播放
            const interval = setInterval(() => {
                if (!isPlaying) {
                    clearInterval(interval);
                    return;
                }
                currentTime += 1;
                updateProgress();
                if (currentTime >= totalTime) {
                    stopAudio();
                }
            }, 1000);
            
            console.log('播放音频');
        }

        function pauseAudio() {
            isPaused = !isPaused;
            isPlaying = !isPaused;
            
            const playBtn = document.getElementById('playBtn');
            const pauseBtn = document.getElementById('pauseBtn');
            
            if (isPaused) {
                pauseBtn.textContent = '▶️ 继续';
                document.getElementById('playbackStatus').textContent = '已暂停';
            } else {
                pauseBtn.textContent = '⏸️ 暂停';
                document.getElementById('playbackStatus').textContent = '播放中...';
            }
            
            playBtn.disabled = isPaused;
            
            console.log('暂停/继续音频');
        }

        function stopAudio() {
            isPlaying = false;
            isPaused = false;
            currentTime = 0;
            
            const playBtn = document.getElementById('playBtn');
            const pauseBtn = document.getElementById('pauseBtn');
            const stopBtn = document.getElementById('stopBtn');
            
            playBtn.disabled = false;
            pauseBtn.disabled = true;
            stopBtn.disabled = true;
            pauseBtn.textContent = '⏸️ 暂停';
            
            document.getElementById('playbackStatus').textContent = '已停止';
            updateProgress();
            
            console.log('停止音频');
        }

        function seekAudio(event) {
            const rect = event.currentTarget.getBoundingClientRect();
            const x = event.clientX - rect.left;
            const percentage = x / rect.width;
            currentTime = Math.floor(percentage * totalTime);
            updateProgress();
        }

        function updateProgress() {
            const progress = totalTime > 0 ? (currentTime / totalTime) * 100 : 0;
            document.getElementById('progressFill').style.width = progress + '%';
            updateTimeDisplay();
        }

        function updateTimeDisplay() {
            const current = formatTime(currentTime);
            const total = formatTime(totalTime);
            document.getElementById('currentTime').textContent = current;
            document.getElementById('totalTime').textContent = total;
        }

        function formatTime(seconds) {
            const mins = Math.floor(seconds / 60);
            const secs = seconds % 60;
            return mins.toString().padStart(2, '0') + ':' + secs.toString().padStart(2, '0');
        }

        // 音频控制
        function adjustVolume(event) {
            const rect = event.currentTarget.getBoundingClientRect();
            const x = event.clientX - rect.left;
            const percentage = x / rect.width;
            const volume = Math.floor(percentage * 100);
            
            document.getElementById('volumeFill').style.width = volume + '%';
            document.getElementById('volumeDisplay').textContent = volume + '%';
            
            console.log('调整音量:', volume);
        }

        // 导出功能
        function exportAudio() {
            document.getElementById('exportModal').style.display = 'flex';
        }

        function confirmExport() {
            closeModal();
            console.log('确认导出');
        }

        // 历史记录
        function selectHistory(element) {
            document.querySelectorAll('.history-item').forEach(item => {
                item.classList.remove('active');
            });
            element.classList.add('active');
            
            const text = element.querySelector('.history-text').textContent;
            document.getElementById('textEditor').value = text;
            updateCharCount();
            
            console.log('选择历史记录');
        }

        // 模板选择
        function selectTemplate(template) {
            const templates = {
                'training': '欢迎参加培训课程，请认真学习并按照要求完成各项任务。',
                'safety': '请注意安全操作，佩戴防护用品，确保工作环境安全。',
                'welcome': '欢迎使用语音合成系统，祝您使用愉快！',
                'instruction': '请按照以下步骤进行操作：第一步，检查设备状态；第二步，确认安全措施；第三步，开始执行任务。'
            };
            
            document.getElementById('textEditor').value = templates[template];
            updateCharCount();
            
            console.log('选择模板:', template);
        }

        // 弹窗控制
        function closeModal() {
            document.getElementById('exportModal').style.display = 'none';
        }

        // 点击弹窗外部关闭
        document.getElementById('exportModal').addEventListener('click', (e) => {
            if (e.target.id === 'exportModal') {
                closeModal();
            }
        });

        // 参数控制
        document.getElementById('speedSlider').addEventListener('input', (e) => {
            document.getElementById('speedValue').textContent = e.target.value + 'x';
        });

        document.getElementById('pitchSlider').addEventListener('input', (e) => {
            document.getElementById('pitchValue').textContent = e.target.value;
        });

        document.getElementById('volumeSlider').addEventListener('input', (e) => {
            document.getElementById('volumeValue').textContent = e.target.value + '%';
        });

        // 文本输入监听
        document.getElementById('textEditor').addEventListener('input', updateCharCount);

        // 初始化
        document.addEventListener('DOMContentLoaded', () => {
            updateCharCount();
            console.log('语音合成页面初始化');
        });
    </script>
</body>
</html>

